// Pass absolute path
pub fn for_path(path: &Path) -> SourceId {
// TODO: use proper path -> URL
- let url = format!("file://{}", path.display());
+ let url = if cfg!(windows) {
+ let path = path.display().to_str();
+ format!("file://{}", path.as_slice().replace("\\", "/"))
+ } else {
+ format!("file://{}", path.display())
+ };
SourceId::new(PathKind, url::from_str(url.as_slice()).unwrap())
}
match self.kind {
GitKind(..) => box GitSource::new(self, config) as Box<Source>,
PathKind => {
- let path = Path::new(self.url.path.as_slice());
+ let mut path = self.url.path.clone();
+ if cfg!(windows) {
+ path = path.replace("/", "\\");
+ }
+ let path = Path::new(path);
box PathSource::new(&path, self) as Box<Source>
},
RegistryKind => unimplemented!()
for error in parser.errors.iter() {
let (loline, locol) = parser.to_linecol(error.lo);
let (hiline, hicol) = parser.to_linecol(error.hi);
- error_str.push_str(format!("{}:{}:{}{} {}",
+ error_str.push_str(format!("{}:{}:{}{} {}\n",
file,
loline + 1, locol + 1,
if loline != hiline || locol != hicol {
execs()
.with_status(101)
.with_stderr("could not parse input TOML\n\
- Cargo.toml:3:19-3:20 expected a value\n"))
+ Cargo.toml:3:19-3:20 expected a value\n\n"))
})
test!(cargo_compile_without_manifest {